
function sleep(ms){
  return new Promise(resolve => {
    setTimeout(resolve, ms);
  })
}

async function fun(arr){
  for(let i = 0; i < arr.length; i++){
    await arr[i]();
  }
}

fun([
  () => console.log("start"),
  () => sleep(1000),
  () => console.log("1"),
  () => sleep(2000),
  () => console.log("2"),
  () => sleep(3000),
  () => console.log("end"),
])




